import {http} from "@/utils"
import { getToken,setToken } from "../utils"
const loginStore=(set)=>{
  return{
    user:"大牛冯",
    token:getToken()||'',
    fetchLogin:async (formData)=>{
      //请求数据
      const res=await http.post('/authorizations',formData)
      //更新状态
      set({token:res.data.token,
        user:formData.mobile
      }),
      setToken(res.data.token)
    },
  }}
  export default loginStore;
